import { BUTTONID, AREA, UISTATUS, FIELDS, CARDTABLEAREAIDS, DELETELINEBTNS, URL } from '../../constance';
import { ajax ,cardCache, getBusinessInfo, toast} from 'nc-lightapp-front';
export default function(props) {

    let checkedRows = props.cardTable.getCheckedRows(AREA.cardBody_1);

    if(checkedRows.length == 0){
        toast({content: '表体至少选择一条数据',color:'danger'});
        return;
    }else if(checkedRows.length > 1){
        toast({content: '表体只能选择一条数据',color:'danger'});
        return;
    }

    let reqdata = {
        hpk : checkedRows[0].data.values['pk_amortization'].value,
        bpk : checkedRows[0].data.values['pk_amortization_b'].value,
        browno : checkedRows[0].data.values['crowno'].value
    };

    ajax({
        url: URL.bodySelected,
        data: reqdata,
        success: (res) => {
            this.props.cardTable.setTableData(AREA.cardBody_2, { rows: res.data.bodys[AREA.cardBody_2].rows });

            this.setState({ isShowRefChoiceBox: !this.state. isShowRefChoiceBox});
        }
    });
    
}


